package com.yuandm.wxnt.util;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
                                      
/* 
 * @author Msquirrel
 */
public class DateUtil {
                                          
    

    public static String getCurrentDate() {
    	SimpleDateFormat sf = null;
        Date d = new Date();
         sf = new SimpleDateFormat("yyyy年MM月dd日");
        return sf.format(d);
    }
                                      

    public static String getDateToString(long time) {
    	time = Long.parseLong(time + "0000");
    	SimpleDateFormat sf = null;
        Date d = new Date(time);
        sf = new SimpleDateFormat("yyyy年MM月dd日");
        return sf.format(d);
    }
                                      

    public static long getStringToDate(String time) {
    	SimpleDateFormat sf = null;
        sf = new SimpleDateFormat("yyyy年MM月dd日");
        Date date = new Date();
        try{
            date = sf.parse(time);
        } catch(ParseException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        return date.getTime();
    }
}